package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.dto.UserDTO;
import com.itheima.pojo.MyUser;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MyUserMapper extends BaseMapper<MyUser> {

    @Select("SELECT\n" +
            "\tuser_name as userName,\n" +
            "\tpassword,\n" +
            "\tcode as authority\n" +
            "FROM\n" +
            "\ttb_user u\n" +
            "\tJOIN tb_role_user ru ON u.id = ru.user_id\n" +
            "\tJOIN tb_role r ON ru.role_id = r.id\n" +
            "\tJOIN tb_role_permission rp ON rp.role_id = r.id\n" +
            "\tJOIN tb_permission p ON p.id = rp.permission_id")
    List<UserDTO> queryUser();
}
